xen/arm: trap guest WFI
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 1 May 2013 10:32:59 +0000 (11:32 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 8 May 2013 10:01:45 +0000 (11:01 +0100)
commita780f750d7fc35ec23b7771516fe11a390d0aa07
treeeda3b01d41ccb2b4fadc0dc69882669836395409
parent6f3059e0e05b72c3cc7246f3e6e81f80761b98cb
xen/arm: trap guest WFI

Trap guest WFI, block the guest VCPU unless it has pending interrupts
(WFI should return if any interrupts arrive even if interrupts are
disabled).

Awake the guest vcpu when a new interrupt for it arrives.

Introduce gic_events_need_delivery: it checks whether the current vcpu
has any interrupts that need to be delivered either on the lrs or in
lr_pending.

Properly implement local_events_need_delivery: check if the guest
disabled interrupts, if they aren't disabled, return positive if
gic_events_need_delivery returns positive. Otherwise we still need to
check whether evtchn_upcall_pending is set but no
VGIC_IRQ_EVTCHN_CALLBACK irqs are in flight: it could be the race
described by commit db453468d92369e7182663fb13e14d83ec4ce456 "arm: vgic:
fix race between evtchn upcall and evtchnop_send". If that is the case
it means that an event needs to be injected.
If all these tests are negative then no events need to be delivered.

Implement local_event_delivery_enable by clearing PSR_IRQ_MASK.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/gic.c
xen/arch/arm/traps.c
xen/arch/arm/vgic.c
xen/include/asm-arm/event.h
xen/include/asm-arm/gic.h